package mobilesmil.data;

import android.graphics.Canvas;

/**
 * Abstract class for SMIL resources that are appropiately displayed in a SmilView.
 */
public abstract class SmilResource {
	/**
	 * Type representing audio.
	 */
	public static final String TYPE_AUDIO = "audio";
	/**
	 * Type representing images.
	 */
	public static final String TYPE_IMAGE = "img";
	/**
	 * Type representing text.
	 */
	public static final String TYPE_TEXT = "text";
	/**
	 * Type representing an undefinded type. This will be the case if an extending class
	 * does not explicitly set the type.
	 */
	public static final String TYPE_UNDEFINED = "none";
	/**
	 * Type representing video.
	 */
	public static final String TYPE_VIDEO = "video";
	
	public static final String ROOT_PATH = "/sdcard/";
	
	private String mType = TYPE_UNDEFINED;	//this is set explicitly by extending classes.
	private String mSource;
	private int mBeginTime;
	private int mEndTime;
	private SmilRegion mRegion;
	
	/**
	 * 
	 * @param source		Name of file where the resource is located.
	 * @param smilRegion	What region should to displayed the resource in.
	 * @param beginTime		When should the resource be displayed.
	 * @param endTime		When should the resource stop being displayed.
	 */
	public SmilResource(String source, SmilRegion smilRegion, int beginTime, int endTime) {
		this.mBeginTime = beginTime;
		this.mEndTime = endTime;
		this.mRegion = smilRegion;
		mSource = source;
	}
	
	public String getType() {
		return mType;
	}
	public void setType(String type) {
		this.mType = type;
	}
	public String getSource() {
		return mSource;
	}
	public void setSource(String source) {
		this.mSource = source;
	}
	public int getBeginTime() {
		return mBeginTime;
	}
	public void setBeginTime(int beginTime) {
		this.mBeginTime = beginTime;
	}
	public int getEndTime() {
		return mEndTime;
	}
	public void setEndTime(int endTime) {
		this.mEndTime = endTime;
	}
	public SmilRegion getSmilRegion() {
		return mRegion;
	}
	public void setSmilRegion(SmilRegion smilRegion) {
		this.mRegion = smilRegion;
	}
	
	/**
	 * This method should appropriately display the resource on the given canvas.
	 * @param canvas	Where the resource will be displayed.
	 */
	public abstract void play(Canvas canvas);
	
	/**
	 * This method should appropiately wipe the resource from the given canvas.
	 * @param canvas
	 */
	public abstract void stop(Canvas canvas);
	
}
